package com.example.androiddemo;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;

import android.app.Application;

public class App extends Application{
	private static App _instance;
	/** volley 请求队列 */
	private static RequestQueue requestQueue;
	
	@Override
	public void onCreate() {
		super.onCreate();
		_instance = this;
	}
	
	public static App instance() {
		return _instance;
	}
	
	public static RequestQueue getReqQueue() {
		if(requestQueue == null) {
			requestQueue = Volley.newRequestQueue(_instance);
		}
		return requestQueue;
	}
	
	public static void closeVolleyReq() {
		if(requestQueue != null) {
			requestQueue.stop();
			requestQueue = null;
		}
	}

}
